﻿using Rechargeable.Amazon.Localization;
using System.Collections.Generic;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Localization;

namespace Rechargeable.Amazon.Permissions;

public class AmazonPermissionDefinitionProvider : PermissionDefinitionProvider
{
    public override void Define(IPermissionDefinitionContext context)
    {
        var myGroup = context.AddGroup(AmazonPermissions.GroupName, L("Permission:Amazon"));
        myGroup.AddPermission(AmazonPermissions.Products, L("Permission:Products"));
    }

    public static string[] GetAll()
    {
        //Return an array of all permissions
        return new List<string>() {
                AmazonPermissions.Products
            }.ToArray();
    }

    private static LocalizableString L(string name)
    {
        return LocalizableString.Create<AmazonResource>(name);
    }
}
